﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _5_NovaAdmin.Infrastructure.Persistence.Repositories
{
    /// <summary>
    /// 实现泛型仓储
    /// </summary>
    /// <typeparam name="TEntity"></typeparam>
    public class BaseRepository<TEntity> : IBaseRepository<TEntity> where TEntity : class
    {
        public readonly AppDbContext _Mddb;
        public virtual DbSet<TEntity> Entity => _Mddb.Set<TEntity>();
        public BaseRepository(AppDbContext Mddb) => _Mddb = Mddb;
        public Task<int> QueryCount(Expression<Func<TEntity, bool>> expression)
        {
            throw new NotImplementedException();
        }

        public Task<bool> QueryExist(Expression<Func<TEntity, bool>> expression)
        {
            throw new NotImplementedException();
        }

        public Task<Tuple<List<TEntity>, int>> QueryPageData(Expression<Func<TEntity, bool>> expression)
        {
            throw new NotImplementedException();
        }

        public Task<Tuple<List<TEntity>, int>> QueryPageData(Expression<Func<TEntity, bool>> expression, string sort, string order)
        {
            throw new NotImplementedException();
        }

        public Task<Tuple<List<TEntity>, int>> QueryPageData(Expression<Func<TEntity, bool>> expression, Func<TEntity, dynamic> sort, string sortType)
        {
            throw new NotImplementedException();
        }

        public Task<Tuple<List<TEntity>, int>> QueryPageData(Expression<Func<TEntity, bool>> expression, IEnumerable<Func<TEntity, dynamic>> sorts, string sortType)
        {
            throw new NotImplementedException();
        }

        public Task<IPageInfo<dynamic>> QueryPageData(Expression<Func<TEntity, bool>> expression, Func<TEntity, dynamic> sort)
        {
            throw new NotImplementedException();
        }

        public async Task<TEntity> FirstOrDefaultAsync(Expression<Func<TEntity, bool>> expression)
        {
            return await Entity.FirstOrDefaultAsync(expression);
        }

        public Task<TEntity> QuerySingleData(Expression<Func<TEntity, bool>> expression, Func<TEntity, dynamic> sort)
        {
            throw new NotImplementedException();
        }

        public Task<TEntity> QuerySingleData(Expression<Func<TEntity, bool>> expression, IEnumerable<Func<TEntity, dynamic>> sorts, string sortType)
        {
            throw new NotImplementedException();
        }

        public Task<List<TEntity>> QueryTableList(Expression<Func<TEntity, bool>> expression)
        {
            throw new NotImplementedException();
        }

        public Task<List<TResult>> QueryTableList<TResult>(Expression<Func<TEntity, bool>> expression, Expression<Func<TEntity, TResult>> result)
        {
            throw new NotImplementedException();
        }
    }
}
